home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / hwRenderTestSetup.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.6 KB  |  141 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Run this script before saving a file for hardware
  19. // rendering test-o-matic tests.
  20. //
  21. // Author : Bernard Kwok
  22. // Last Updated: Sept, 26, 2002
  23. //
  24. global proc setSoftwareQualityToProduction()
  25. {
  26.   // Set software to production quality preset. Taken
  27.   // from renderGlobalsWindow.mel
  28.   //
  29.   string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
  30.  
  31.   setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
  32.   setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
  33.   setAttr ($rendQual[0] + ".shadingSamples") 2;
  34.   setAttr ($rendQual[0] + ".maxShadingSamples") 8;
  35.   setAttr ($rendQual[0] + ".visibilitySamples") 1;
  36.   setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
  37.   setAttr ($rendQual[0] + ".redThreshold") 0.4;
  38.   setAttr ($rendQual[0] + ".greenThreshold") 0.3;
  39.   setAttr ($rendQual[0] + ".blueThreshold") 0.6;
  40.   setAttr ($rendQual[0] + ".reflections") 10;
  41.   setAttr ($rendQual[0] + ".refractions") 10;
  42.   setAttr ($rendQual[0] + ".shadows") 10;
  43.  
  44.   updateRenderQuality;
  45. }
  46.  
  47. // Set for <sceneName>.#.ext or <sceneName>
  48. global proc setSoftwareFrameExtension(int $animate)
  49. {
  50.   if ($animate) {
  51.  
  52.     // Animation on
  53.     setAttr defaultRenderGlobals.animation 1; 
  54.     if (`checkBoxGrp -q -v1 imageCheckBox`) {
  55.       // Override image file format type
  56.       setAttr defaultRenderGlobals.outFormatControl 2;  
  57.     } else {
  58.       // Standard image file format type
  59.       setAttr defaultRenderGlobals.outFormatControl 0;    
  60.     }
  61.     setAttr "defaultRenderGlobals.putFrameBeforeExt" 1;
  62.     setAttr "defaultRenderGlobals.periodInExt" 1;
  63.   }
  64.   else {
  65.     // Animation off
  66.     setAttr defaultRenderGlobals.animation 0;
  67.     // No image file format type        
  68.     setAttr defaultRenderGlobals.outFormatControl 1;    
  69.     setAttr "defaultRenderGlobals.periodInExt" 1;
  70.   }
  71.  
  72.   updateFrames;
  73.   updateExtOptions;
  74.   updateFileOutputFeedback;
  75.  
  76.   // Also update the main render window if it exists.
  77.   if (`exists updateMainRenderMenu`) {
  78.     updateMainRenderMenu();
  79.   }
  80.   // And the batch render window    
  81.   if (`exists updateBatchRenderWindowTitle`) {
  82.     updateBatchRenderWindowTitle();
  83.   }
  84. }
  85.  
  86. global proc hwRendertestSetup(int $startFrame, int $endFrame, int $byFrame)
  87. {
  88.   // Load the hw renderer
  89.   hwRenderLoad;
  90.   string $hwRenderNodes[] = `ls -type hardwareRenderGlobals`;
  91.   int $i;
  92.   int $haveHwRenderGlobals = 0;
  93.   for ($i=0; $i<size($hwRenderNodes); $i++)
  94.   {
  95.     if ($hwRenderNodes[$i] == "hardwareRenderGlobals")
  96.         $haveHwRenderGlobals = 1;
  97.     else
  98.         delete $hwRenderNodes[$i];
  99.   }
  100.   if ($haveHwRenderGlobals = 0)
  101.   {
  102.     string $newNode = `createNode hardwareRenderGlobals`;
  103.     rename $newNode "hardwareRenderGlobals_blah";
  104.     rename "hardwareRenderGlobals_blah" "hardwareRenderGlobals";
  105.   }
  106.  
  107.   //** Setup hardware globals
  108.   // Start-end frame
  109.   setAttr "hardwareRenderGlobals.startFrame" $startFrame;
  110.   setAttr "hardwareRenderGlobals.endFrame" $endFrame;
  111.   setAttr "hardwareRenderGlobals.byFrame" $byFrame;
  112.  
  113.   // TIFF
  114.   setAttr hardwareRenderGlobals.imageFormat 3; 
  115.  
  116.   //** Setup sofware globals
  117.   setSoftwareQualityToProduction; // Production quality
  118.   setAttr defaultRenderGlobals.imageFormat 3; // TIFF
  119.   setAttr defaultRenderGlobals.startFrame $startFrame;
  120.   setAttr defaultRenderGlobals.endFrame $endFrame;
  121.   setAttr defaultRenderGlobals.byFrameStep $byFrame;
  122.   setAttr defaultRenderGlobals.renderAll 1;
  123.   
  124.   if ($startFrame != $endFrame) {
  125.  
  126.     // Set software render globals
  127.     setSoftwareFrameExtension(1);
  128.  
  129.     // Set hardware render globals
  130.     setAttr -type "string" hardwareRenderGlobals.filename "%s.%4n";
  131.   }
  132.  
  133.   else {
  134.     // Set software render globals
  135.     setSoftwareFrameExtension(0);
  136.  
  137.     // Set hardware render globals
  138.     setAttr -type "string" hardwareRenderGlobals.filename "%s";
  139.   }
  140. }
  141.